package com.kclmedu.mvc.config;

import com.alibaba.druid.pool.DruidDataSource;
import org.apache.log4j.Logger;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.*;
import org.springframework.core.env.Environment;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.core.io.support.ResourcePatternResolver;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import javax.sql.DataSource;
import java.io.IOException;

/**
 * Created by yejf
 * Spring 配置类
 * 通过编程的方式来生成 DataSource Bean, SessionFactory Bean, 以及 PlatformTransactionManager Bean
 */

@Configuration
@ComponentScan({"com.kclmedu.mvc.service"})
@PropertySource("classpath:db.properties")
@EnableAspectJAutoProxy  //启动AOP
//@EnableTransactionManagement //启动基于注解的 声明式事务
public class AppConfig {

    //日志信息
    private static final Logger LOGGER = Logger.getLogger(AppConfig.class);

    public AppConfig() {
        LOGGER.debug("---- 初始化 AppConfig 实例....");
    }

}
